<template>
	<view>
		
		<view class="list_box">
		  <view class="title">姓名</view>
		  <input class="text" placeholder="请输入" v-model="name"></input>
		</view>
		<view class="list_box">
		  <view class="title">银行</view>
		  <input class="text" placeholder="请输入" v-model="bank_name"></input>
		</view>
		<view class="list_box">
		  <view class="title">银行卡号</view>
		  <input class="text" placeholder="请输入" v-model="card"></input>
		</view>
		
		<view class="list_box">
		  <view class="title">银行卡绑定电话</view>
		  <input class="text" placeholder="请输入" v-model="phone"> </input>
		</view>
		
		
		
		  
		
		
		
		
		<button class="confirm" @tap="go()">提交</button>
		
		
		
	</view>
</template>

<script>
	
	export default {
	data() {
		return {
			name:'',
			card:'',
			bank_name:'',
			phone:'',
			id:'',
		};
	},

	onLoad(e) {
		let me = this;
		if(e.id)me.id=e.id
	
		if(e.id)
		{
			me.Net._get('bankData',{id:e.id},(res)=>{
				if(res.code ==1){
					me.name=res.data.name
					me.phone=res.data.phone
					me.card=res.data.card
					me.bank_name=res.data.bank_name
				
				  console.log(res.data)
				}
			});	
		}
	},
	methods: {
		
		go() {
			
			var that = this;	
			if(!that.name || !that.card || !that.bank_name ||  !that.phone)
			{
				that.Msg.Fail('请输入完整信息');
				return
			}
				console.log(that.data)
				that.Net._get('upBank',{id:that.id,name:that.name,card:that.card,phone:that.phone,bank_name:that.bank_name},(res)=>{
					if(res.code ==1){
						that.Msg.Success('提交成功',(res)=>{
						uni.navigateBack()
						})
					}
				});
		},
	}
};
</script>


<style>
	page{
		background-color: #f8f8f8;
	}
	.list_box{
	  width: 100%;
	  height: 60px;
	  background-color: #fff;
	  position: relative;
	  margin-bottom: 1px;
		
	}
	
	.list_box:nth-child(1){
	  margin-top: 10px;
	  display: inline-block;
	}
	
	.list_box .title{
	  font-size: 14px;
	  color: #333;
	  line-height: 60px;
	  position: absolute;
	  left: 26px;
	}
		
	
	.list_box .text{
	  height: 60px;
	  line-height: 60px;
	  font-size: 14px;
	  color: #666;
	  text-align: right;
	  position: absolute;
	  right: 26px;
	  width: 60%;
	}
	
	
	
	textarea{
	  width: 100%;
	  height: 100px;
	  padding: 10px;
	  font-size: 12px;
	  color: #333;
	  background-color: #fff;
	  text-indent: 16px;
	}
	
</style>
